﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperWebSocket.SubProtocol;
using Newtonsoft.Json;

namespace WebCommand.Command
{
    public class USER_LIST : SubCommandBase<MySession>
    {
        public override void ExecuteCommand(MySession session, SubRequestInfo requestInfo)
        {
            var list = session.Server.GetAllSessions().Select(m => new { Name = m.UserName }).ToList();

            session.SendResponseAsync(string.Format("USER_LIST {0}", JsonConvert.SerializeObject(new { List = list })));

        }
    }
}
